CC = arm-none-eabi-gcc
AS = arm-none-eabi-as

CFLAGS += -march=armv6

bootloader.mem: bootloader.bin
	../memfile/bintomem $< $@

bootloader.bin: bootloader.o
	arm-none-eabi-objcopy -O binary -j .start -j .text -j .rodata -j .data \
		$< $@
bootloader.o: bootloader.lds main.o uart.o printf.o start.o xmodem.o
	$(CC) -o $@ -T $^ -nostdlib -lgcc

main.o: main.c uart.h timer.h
uart.o: uart.c uart.h

clean:
	rm -f *.o bootloader.{bin,mem}

.PHONY: clean
